<?php

class ElectionEvent extends Model{

	function ElectionEvent()
    {
        parent::Model();
    	$this->_table = 'event';
    }
    
    function get_all()
	{
		$this->db->order_by('event_start', 'asc');
		return $this->db->get($this->_table);
	}
	
	function get_event_by_id($event_id)
	{
		$this->db->where('id', $event_id);
		return $this->db->get($this->_table);
	}
	
	function saveForm($form_data){
		$this->db->insert($this->_table, $form_data);
		
		if ($this->db->affected_rows() == '1')
		{
			return TRUE;
		}
		
		return FALSE;
	}
		
}

?>